package com.hsp.Demo_02_array;

public class Demo_05 {
    public static void main(String[] args) {
        /*
        数组的拷贝
            1、值传递【值拷贝】
            2、引用传递【地址拷贝】
         */
        //1、值传递：
        int a = 10;
        int b = a;
        System.out.println("=====修改前=====");
        System.out.println(a);  //10
        System.out.println(b);  //10
        System.out.println("=====修改后=====");
        b = 5;
        System.out.println(a);  //10
        System.out.println(b);  //5
        System.out.println("=======================");
        int[] arr1 = {1, 2, 3, 4};
        int[] arr2 = arr1;
        System.out.println("=====修改前=====");
        System.out.println(arr1[0]);    //1
        System.out.println(arr2[0]);    //1
        System.out.println("=====修改后=====");
        arr2[0] = 4;
        System.out.println(arr1[0]);    //4
        System.out.println(arr2[0]);    //4
    }
}
